Using SCP

(by Bernie Case, berniec@technojunkie.org)

The shell command "scp" does not allow you to pass along a password within the actual command, so you have to create SSH keys which would perform all of the actual authentication.

On your workstation:
1. Open up Terminal.app
2. cd .ssh
3. ssh-keygen -t rsa1  (creates an RSA1 key pair for SSH protocol version 1 communication.)
3a. Choose default location, and leave the passphrase empty.
4. ssh-keygen -t dsa  (creates a DSA key pair for SSH protocol version 2 communication.)
4a. Choose default location, and leave the passphrase empty.
5. ssh-keygen -t rsa (creates an RSA key pair for SSH protocol version 2 communication.)

Since I am doing this all on the same machine, the following commands will
be actually done on the remote server.  The following commands assume you'll
have shell access to the remote server.  If you don't, you'll probably want to use FTP anyway.

5. Copy identity.pub, id_dsa.pub and id_rsa.pub to the remote SSH server.  Don't copy
them to the .ssh directory on the remote server.

On the remote server:
6. cat identity.pub >> ~/.ssh/authorized_keys (appends the line in the file
to the end of authorized_keys, for SSH protocol version 1 communication)
7. cat id_dsa.pub >> ~/.ssh/authorized_keys2  (appends the line in the
file to the end of authorized_keys2, for SSH protocol version 2 communication)
8. cat id_rsa.pub >> ~/.ssh/authorized_keys2

You've now created the authorized keys files.  If you SSH to the remote
server, you won't be prompted for a password.

Now, as for the SCP command, this will finally become:

scp -oProtocol=1 /path/to/local/file username@host:/path/to/remote/file

Change -oProtocol=1 to -oProtocol=2 if using SSH protocol version 2.

Notes: 
1. Make sure your .ssh directory is NOT group/world readable.  (chmod -R 0600 ~/.ssh will take care of this)
2. SSH to the remote server after creating and moving your SSH keys into place.  You will be prompted to accept the remote server's host key.  Once accepted, Kung-Tunes will function normally.  If you miss this step, Kung-Tunes will likely fail during uploads with a "host key error."